﻿// ....................................................................................................................
//	Author: Copyright (C) 2012 Ing. Marek Hubal
//	Email: hubal@acasoftware.org
// ....................................................................................................................

using System;

namespace core
{
    /// <summary>Trieda IButton</summary>
	public class IButton : System.Windows.Forms.Button
	{
        public const int MIN_BUTTON_WIDTH = 84;
        public const int MIN_BUTTON_HEIGHT = 28;

        /// <summary>Trieda IButton</summary>
        /// <param name="pCaption">text tlacidla</param>
        /// <param name="pClickHandler">handler pre Click event</param>
        /// <param name="pAutoSize">priznak automatickej velkosti</param>
        public IButton(string pCaption = "", EventHandler pClickHandler = null, bool pAutoSize = true)
        {
            Text = pCaption; // Nastavim text
            if (pAutoSize) // Nastavim autosize
            {
                AutoSize = true;
                MinimumSize = new System.Drawing.Size(MIN_BUTTON_WIDTH, MIN_BUTTON_HEIGHT);
            }
            if (pClickHandler != null) Click += pClickHandler;
        }
    }
}
